<div class="row">
    <div class="col-md-12">
        <div class="block">
            <div class="block-title">
                <h2><strong>Formulario de Edicion de Serie</strong></h2>
            </div>
            <?php echo $this->Form->create('Serie',array('class' => 'form-horizontal form-bordered'));?>
            <?php echo $this->Form->hidden('id');?>
            <fieldset>
                <div class="form-group">
                    <label class="col-md-2 control-label" >Desde<span class="text-danger">*</span></label>
                    <div class="col-md-3">   
                            <?php echo $this->Form->text('desde',array('id'=>'inicial','class'=>'form-control','type'=>'number','required','disabled'));?>
                    </div> 
                    <label class="col-md-2 control-label" >Hasta<span class="text-danger">*</span></label>
                    <div class="col-md-3">   
                            <?php echo $this->Form->text('hasta',array('id'=>'final','class'=>'form-control','type'=>'number','required'));?>
                        
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label" >Serie<span class="text-danger">*</span></label>
                    <div class="col-md-3">
                            <?php echo $this->Form->text('nombre',array('class'=>'form-control','required'));?>
                    </div>
                </div>
            </fieldset>
            <div class="form-group form-actions">
                <div class="col-md-8 col-md-offset-4">
                <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-arrow-right"></i> Guardar</button>
                </div>
                
            </div>
        </div>
    </div>
</div>
<script>
$("#final").change(function()
{
   if($("#final").val()<=$("#inicial").val()){
    // alert($("#inicial").val()); 
   //alert($("#final").val());
    var minimo=$("#inicial").val();
    minimo=parseInt(minimo);
    $("#final").attr('min',minimo);
   } else{
       var min=$("#inicial").val();
   }
});
$("#inicial").change(function()
{
    if($("#final").val()<=$("#inicial").val()){
        var minimo=$("#inicial").val();
        minimo=parseInt(minimo);
        $("#final").attr('min',minimo);
    }else{
        var min=$("#inicial").val();
    }
});
</script>